package cn.edu.sig.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.sig.bean.CurrentPage;
import cn.edu.sig.bean.User;
import cn.edu.sig.dao.UserDao;

@Service("userService")
@Transactional
public class UserService {
	@Resource(name="userDao")
	private UserDao userDao;

	
	public void add(User user){
		
		userDao.add(user);
	}
	
	public List<User> findAll(){
		
		return userDao.findAll();
	}
	
	public void register(User user){
		
		userDao.register(user);
	}
	
	public User findByCode(String  code){
		
		return userDao.findById(code);
	}
	
	public void editUser(User user){
		
		userDao.edit(user);
	}
	
	public void updatePassword(String code,String password){
		
		userDao.updatePassword(code, password);
	}
	
	public CurrentPage<User> findUserList(int pageNo,int pageSize){
		
		return userDao.findUserList(pageNo, pageSize);
		
	}
}
